VLOG_OPTS = +libext+.v  \
	+libext+.sv  \
	$(SVERILOG_OPT) \
	+no_notifier  \
	+warn=noTMR  \
	+lint=all,noTMR,noVCDE,noIEELMME,noIWU,noZERO  \
	+v2k  \
	$(CMD_LINE) \
        +incdir+$(DES_DIR) \
	+incdir+$(TB_DIR) \
	-debug_pp \
        -notice \
        -R \

LIB_DIRS = -y $(DES_DIR) 

HDL_FILES = \
	$(DES_DIR)/vga_ctrl.v \
	$(DES_DIR)/vga_get_colors.v \
	$(DES_DIR)/vga_timer.v \
	$(TB_DIR)/$(TB_FILE) \

DES_DIR  = ../../des/vga
TST      = tb_vga
TB_DIR   = ../../verif/vga_tb
TB_FILE  = tb_vga.v
RUN      = run_vcs
VCS      := $(shell which vcs)

# Look to see if vcs is installed
ifeq ($(VCS),)
RUN = run_i
endif

run:
	make $(RUN)

run_vcs:
	vcs \
	$(VLOG_OPTS) \
        $(LIB_DIRS) \
        +vpdfile+$(TST).vpd \
        -l $(TST).log \
	$(TB_DIR)/$(TB_FILE)

run_i:
	iverilog -g2001 -DIVERILOG -I$(DES_DIR) -tvvp -Wall -Wno-timescale -DIVERILOG $(HDL_FILES)
	vvp a.out -lxt2

CLEAN:
	rm -rf csrc *.vpd simv simv.daidir *.log *.vcd a.out *.lxt2
